//
//  SMSystemMacro.h
//  DiDi
//
//  Created by huangtie on 2017/2/28.
//  Copyright © 2017年 Sinmore. All rights reserved.
//

#ifndef SMSystemMacro_h
#define SMSystemMacro_h

/** 是否打印日志 */
#ifdef DEBUG
#   define SMLog(fmt, ...) {NSLog((@"%s [Line %d]\n " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);}
#else
#   define SMLog(...)
#endif

/** 当前系统的版本号 */
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

/** 屏幕宽度 */
#define SCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)
/** 屏幕高度 */
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

/** 获取window */
#define GETWINDOW [[[UIApplication sharedApplication] delegate] window]

/** 屏幕宽占比(5/5s) */
#define FLEXIBLE_WIDTH_35INCH(x) ((x) / 320.0 * SCREEN_WIDTH)
/** 屏幕宽占比(6/6s) */
#define FLEXIBLE_WIDTH_55INCH(x) ((x) / 375.0 * SCREEN_WIDTH)

/** 判断是否是iPhone4、iPhone4s设备 */
#define IS_35INCH_DEVICE        (SCREEN_HEIGHT==480)
/** 判断设备是否是iPhone5、iPhone5s */
#define IS_4INCH_DEVICE         (SCREEN_HEIGHT==568)
/** 判断设备是否是iPhone6 */
#define IS_47INCH_DEVICE        (SCREEN_WIDTH==375)
/** 判断设备是否是iPhone6Plus */
#define IS_55INCH_DEVICE        (SCREEN_WIDTH==414)

#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;

/**
 整数转会为字符串
 */
#define INT_TO_STR(intValue) [NSString stringWithFormat:@"%d",(int)intValue]
/**
 字符串拼接字符串
 */
#define STR_TO_STR(str,fmt) [NSString stringWithFormat:@"%@%@", str, fmt]
/**
 浮点数转换为字符串
 */
#define DOUBLE_TO_STR(value) [NSString stringWithFormat:@"%.2f",(double)value]

#endif /* SMSystemMacro_h */
